const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    merid:0,
    id:0,
    bannerHeight:150,
    good:{}
  },
  imageLoad: function (e) {
    var res = wx.getSystemInfoSync();
    var imgwidth = e.detail.width,
      imgheight = e.detail.height,
      ratio = imgwidth / imgheight;
    this.setData({
      bannerHeight: res.windowWidth / ratio
    })

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.data.merid = options.merid
    this.data.id = options.id
    app.get('merapi/index/mer_goods_detail',{
      merid:this.data.merid,
      id:this.data.id
    }).then(res=>{
      console.log(res)
      if(res.data.code == 0) {
        let good = res.data.data.good
        good.description_url = app.globalData.remote_static + good.description_url
        let imgs = good.images.split(",")
        good.images = []
        for(let img of imgs) {
          good.images.push(app.globalData.remote_static + img)
        }
        good.keywords = good.keyword.split(",")
        this.setData({
          good:good
        })

      }
    }).catch(err => {
      console.log(err)
    })
  }
})